import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { HttpRouter } from '../service/httpRouter'
import { HttpService } from '../service/httpService'


declare var $:any;

@Component({
  selector: 'app-faq',
  templateUrl: './faq.component.html',
  styleUrls: ['./faq.component.less']
})
export class FaqComponent implements OnInit {
  private title = "常见问题";
  public faqlist :any[];
  public faqId = "";
  constructor(
    private httpRouter : HttpRouter,
    private httpService : HttpService,
    public activeRoute: ActivatedRoute
  ) { }

  ngOnInit() {
    this.getList();
  }

  getList(){
    this.activeRoute.params.subscribe(
      params => {
        this.faqId = params["id"];

      }
    );

    this.httpService.get("../../assets/faq.json").subscribe(data => {
        this.faqlist = data;
    });
  }


  show(event){
    if($(event.currentTarget).hasClass("active")){
      $(event.currentTarget).removeClass("active");
    }else{
      $(event.currentTarget).addClass("active");
    }
  }



}
